﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.CMS.Common.Utility;
using Runda.CMS.Bll;
using Runda.CMS.Common.Entity;

namespace Runda.CMS.Portal.ContractFollowUp
{
    public partial class InstrumentConservation_config : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data_Bind();
            }
        }

        private void Data_Bind()
        {
            SysDictionaryBll sysDicBll = new SysDictionaryBll();
            List<SqlDbParameter> parameters = new List<SqlDbParameter>();
            List<WsmConservationEntity> lists = sysDicBll.GetAll<WsmConservationEntity>(" and 1=1", " order by OrderNum desc");
            this.RepeaterParms.DataSource = lists;
            this.RepeaterParms.DataBind();

        }

        protected void delete(object sender, EventArgs e)
        {
            if (dicids.Value.Trim() != "")
            {
                string[] dicidsArray = dicids.Value.Trim().Split(new char[] { ';' });
                for (int index = 0; index < dicidsArray.Length; index++)
                {
                    SysDictionaryBll bll = new SysDictionaryBll();
                    WsmConservationEntity dicEntity = bll.Get<WsmConservationEntity>(new Guid(dicidsArray[index]));
                    if (dicEntity != null)
                    {
                        bll.LogicDelete(dicEntity);
                    }
                }                        
                Data_Bind();
            }
        }

        protected void RepeaterParms_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "refersh")
            {               
                Data_Bind();
            }
        }
    }
}
